<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .loader{
      position: relative;
      width: 8px;
      height: 35px;
      background: red;
      margin: 0 auto;
      animation: loading 0.3s linear 0s infinite alternate;
    }
    .loader:after , .loader:before{
      position: absolute;
      content: '';
      width: 8px;
      height: 35px;
      background: red;
    }
    .loader:after{
      transform: scale(1,0.5);
      margin-left: -10px;
      animation: loading 0.5s linear 0.5s infinite alternate-reverse;
    }
    .loader:before{
      transform: scale(1,0.3);
      margin-left: 10px;
      animation: loading 0.5s linear 0.5s infinite alternate-reverse;
    }
    @keyframes loading{
      from{
        opacity: 0.5;
        transform: scale(1,0.5);
      }
      to{
        opacity: 1;
        transform: scale(1,1);
      }
    }
  </style>
</head>
<body>
  <div class="loader"></div>
</body>
</html>